const mysql = require('mysql');

let db = mysql.createPool({
    host:'localhost',
    port:8889,
    user:'root',
    password:'root',
    database:'jy1608_blog'
})

module.exports = {
    query:function(sql){
        return new Promise((resolve,reject)=>{
            db.query(sql,(err,data)=>{
                if(err){
                    reject(err);
                }else{
                    resolve(data);
                }
            })
        })
    }
}
